package com.example.databinding;

import android.os.Bundle;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;


import com.example.databinding.databinding.ActivityMainBinding;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {

    private User user;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        setContentView(R.layout.activity_main);
        ActivityMainBinding activityMainBinding = DataBindingUtil.setContentView(this,R.layout.activity_main);
        user = new User("张三","123456");
        activityMainBinding.setUserInfo(user);
        ArrayList arrayList = new ArrayList();
        arrayList.add("111111");
        activityMainBinding.setList(arrayList);
        activityMainBinding.setHandlers(eventHandlers);
    }

    EventHandlers eventHandlers = new EventHandlers();


    public void btnClick(View view) {
        user.setName("李四");
    }
}
